#ifndef _FIFO_H
#define _FIFO_H

struct fifo_node
{
	struct fifo_node *next;
	void *data;
};

typedef void *(*fifo_alloc)(void *);
typedef void (*fifo_free)(void *);

struct fifo_head
{
	struct fifo_node *head;
	struct fifo_node *tail;
	fifo_alloc data_alloc;
	fifo_free data_free;
};

bool fifo_init(struct fifo_head *head, fifo_alloc data_alloc,
		fifo_free data_free);

bool fifo_push(struct fifo_head *head, void *arg);

struct fifo_node *fifo_get_first(struct fifo_head *head);

void fifo_pop(struct fifo_head *head);

void fifo_clear(struct fifo_head *head);
#endif
